<!--
 * @Author: gy
 * @Date: 2020-07-02 16:26:13
 * @LastEditors: gy
 * @LastEditTime: 2020-07-02 16:44:44
-->
<script>
import Oidc from "oidc-client";
import { openIdConnectSettings } from "@/config/oidc";
export default {
  name: 'SaveAuth',
  created() {
    this.mgr =  new Oidc.UserManager(openIdConnectSettings);
    this.mgr.getUser().then((user) => {
      localStorage.setItem('userInfo',JSON.stringify(user))
      localStorage.setItem('token',user['access_token'])
      localStorage.setItem('token_type',user['token_type'])
      this.$router.push('/')
    })
  },
  render: function(h) {
    return h() // avoid warning message
  }
}
</script>
